package com.ruoyi.supply.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.SecurityUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 *  会员操作日志
 * @author huangxiong
 * @date 2025/06/15 11:06
 */
@TableName("t_member_log")
@Data
public class TMemberLog {
    @TableId(type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty("id")
    private Long id;

    private Long fkMemberId;

    private Long fkTableId;

    private String fkTableType;

    private String remark;

    private String extra;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    public static TMemberLog simpleBuild(Long fkTableId,String fkTableType){
        TMemberLog tMemberLog = new TMemberLog();

        tMemberLog.setFkMemberId(SecurityUtils.getUserId());
        tMemberLog.setFkTableId(fkTableId);
        tMemberLog.setFkTableType(fkTableType);
        tMemberLog.setCreateTime(new Date());

        return tMemberLog;
    }

}
